<template>
  <div>
    <el-table :data="list" height="58vh" style="width: 100%">
      <el-table-column prop="title" label="标题"> </el-table-column>
      <el-table-column prop="browse" label="浏览数" width="100">
      </el-table-column>
      <el-table-column prop="comments" label="评论数" width="100">
      </el-table-column>
      <el-table-column prop="time" label="时间" width="200"> </el-table-column>
    </el-table>
    <Pagination :get-list="getList" :len="len" />
  </div>
</template>

<script>
import Pagination from '@/components/public/pagination'
export default {
  components: { Pagination },
  props: {
    id: {
      type: Number,
      required: true
    }
  },
  data() {
    return { list: [], len: 100 }
  },
  methods: {
    async getList(page, limit) {
      const { status, data } = await this.$axios.get('/author/dynamic', {
        params: {
          id: this.id,
          limit,
          page
        }
      })
      if (status === 200 && data.code === 1) {
        this.len = data.len
        this.list = data.data
      }
    }
  }
}
</script>

<style lang="scss" scoped>
/deep/ .el-table__body-wrapper {
  @include scroll();
}
</style>
